import NetSDK from "./NetSDK";

export default class NetQuest {

    public static readonly NEWS_URL = "http://v.juhe.cn/toutiao/index";

    //请求新闻
    public static questNews(callback) {
        let APPKEY = "bc3ef64a68eee2162e0f1e6a2afbda02";
        let url = "http://v.juhe.cn/toutiao/index?type=top&key=" + APPKEY;
        NetSDK.getInstance().send(url, callback);
    }

    //请求热门视频
    public static questVideo(callback) {
        let APPKEY = "03a3884b73a5431cb76dbff545751126";
        let url = "http://v.juhe.cn/toutiao/index?type=top&key=" + APPKEY;
        NetSDK.getInstance().send(url, callback);
    }

    //请求笑话
    public static querstJoke(callback) {
        let APPKEY = "6ef88118eb406ded4b8f74d34b72d295";
        let time = Math.trunc(new Date().getTime() / 1000);
        let url = `http://v.juhe.cn/joke/content/list.php?key=${APPKEY}&page=1&pagesize=1&sort=desc&time=${time}`
        NetSDK.getInstance().send(url, callback);
    }
}
